//
//  TabBarVC.m
//  ZPrograme
//
//  Created by 周成龙 on 16/6/16.
//  Copyright © 2016年 none. All rights reserved.
//

#import "TabBarVC.h"
#import "UIImage+image.h"
#import "VDJConstant.h"
#import "ZNavigationController.h"

#import "ViewController.h"

@interface TabBarVC ()

@end

@implementation TabBarVC

+ (void)initialize
{
    // 获取当前这个类下面的所有tabBarItem
    UITabBarItem *item = [UITabBarItem appearanceWhenContainedIn:self, nil];
    // 创建属性字典
    NSMutableDictionary *att = [NSMutableDictionary dictionary];
    att[NSForegroundColorAttributeName] = kBlackFontColor;
    // 设置模型的标题属性修改控件的文字颜色
    [item setTitleTextAttributes:att forState:UIControlStateSelected];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setUpAllChildViewController];
}

-(void)setUpAllChildViewController
{
    ViewController * stu = [[ViewController alloc]init];
    ZNavigationController * stuNav = [[ZNavigationController alloc]initWithRootViewController:stu];
    [self setOneChildViewController:stuNav image:[UIImage imageNamed:@"study_nor"] selectedImage:[UIImage imageWithOriginalName:@"study_sel"] title:@"学习"];

//    ShowVC * show = [[ShowVC alloc]init];
//    ZNavigationController * showNav = [[ZNavigationController alloc]initWithRootViewController:show];
//    [self setOneChildViewController:showNav image:[UIImage imageNamed:@"show_nor"] selectedImage:[UIImage imageWithOriginalName:@"show_sel"] title:@"秀场"];
//
//    UserVC * four = [[UserVC alloc]init];
//    ZNavigationController * fourNav = [[ZNavigationController alloc]initWithRootViewController:four];
//    [self setOneChildViewController:fourNav image:[UIImage imageNamed:@"me_nor"] selectedImage:[UIImage imageWithOriginalName:@"me_sel"] title:@"我的"];
}

-(void)setOneChildViewController:(UIViewController*)vc image:(UIImage*)image selectedImage:(UIImage*)selectedImage title:(NSString*)title
{
    vc.tabBarItem.title = title;
    vc.tabBarItem.image = image;
    vc.tabBarItem.selectedImage = selectedImage;
    [self addChildViewController:vc];
}

@end
